﻿using SmartWMS.Domain.Base;
using SmartWMS.Domain.BasicsDatum;
using SmartWMS.Domain.BusinessManage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartWMS.Server.BusinessServer.ProcureMentServices.Dto
{
    public class ProcureMentDtos
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 采购单号
        /// </summary>
        public string? ProcurementCode { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string? ProductCode { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string? ProductName { get; set; }

        /// <summary>
        /// 規格
        /// </summary>
        public string? Specs { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 购买数量
        /// </summary>
        public int BuyNumber { get; set; }

        /// <summary>
        /// 总价
        /// </summary>
        public decimal SumPrice { get; set; }

        /// <summary>
        /// 供应商编号
        /// </summary>
        public string? SupplierCode { get; set; }

        /// <summary>
        /// 供应商名称
        /// </summary>
        public string? SupplierName { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public ProcurementState ProcurementState { get; set; }


        public string? ProcurementStateName
        {
            get
            {
                if (ProcurementState == ProcurementState.全部入库)
                {
                    return "全部入库";
                }
                else if (ProcurementState == ProcurementState.部分入库)
                {
                    return "部分入库";

                }
                else if (ProcurementState == ProcurementState.采购中)
                {
                    return "采购中";
                }
                else
                {
                    return "订单取消";
                }
            }
        }

        /// <summary>
        /// 是否入账
        /// </summary>
        public bool ProcurementProcurement { get; set; }=false;

        /// <summary>
        /// 是否退货
        /// </summary>
        public bool IsReFund { get; set; } = false;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime ProcurementTime { get; set; }

        /// <summary>
        /// 单据类型
        /// </summary>
        public int DocumentType { get; set; }

        /// <summary>
        /// 单据状态
        /// </summary>
        public int DocumentState { get; set; }

        /// <summary>
        /// 关联销售单号
        /// </summary>
        public string? SaleCode { get; set; }

        /// <summary>
        /// 制单人
        /// </summary>
        public string? MakerName { get; set; }

        /// <summary>
        /// 制单日期
        /// </summary>
        public DateTime MakerTime { get; set; }

        /// <summary>
        /// 收货时间
        /// </summary>
        public DateTime ReceiptTime { get; set; }

        /// <summary>
        /// 联系人
        /// </summary>
        public string? ContactName { get; set; }

        /// <summary>
        /// 电话
        /// </summary>
        public string? Phone { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 批量删除Id
        /// </summary>
        public string? DelId { get; set; }


        public List<ShoppingDto>? ShoppingList { get; set; }
        
        /// <summary>
        /// 客户
        /// </summary>
        public string? ClientName { get; set; }

    }
}
